package com.mrjy.maintain.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.ApplyLectureInfo;
import com.mrjy.common.entity.UserInfo;
import com.mrjy.common.util.GlobalConstant;
import com.mrjy.maintain.bo.IApplyLectureInfoBo;

@Controller
@RequestMapping("/maintain/lectureInfo")
public class ApplyLectureInfoController{
	@Resource
	private IApplyLectureInfoBo lectureInfoBo;
	

	/**
	 * 显示信息
	 * @return
	 */
	@RequestMapping("/lectureInfoList")
	@ResponseBody
	public Object newsInfoList(ApplyLectureInfo applyLectureInfo) {
		
		return lectureInfoBo.queryPageApplyLectureInfo(applyLectureInfo);
	}
	
	
	
	
	/**
	 * 添加
	 * @return
	 */
	@RequestMapping("/addLectureInfo")
	@ResponseBody
	public Object insert(ApplyLectureInfo applyLectureInfo){
		lectureInfoBo.insert(applyLectureInfo);
		return "ok";
	}
	/**
	 * 根据ID查询
	 * @return
	 */
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int id) {
		return lectureInfoBo.queryById(id);
	}
	/**
	 * 修改
	 * @param userNews
	 * @return
	 */
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(ApplyLectureInfo applyLectureInfo,HttpSession session) {
		UserInfo userInfo = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO));	
		lectureInfoBo.updateById(applyLectureInfo);
		return "ok";
	}
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return lectureInfoBo.deleteByIds(ids);
	}
	/**
	 * 禁用、起用
	 * @param ids
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(ApplyLectureInfo applyLectureInfo) {		
		return lectureInfoBo.updateDisableFlag(applyLectureInfo);
	}
}
